package com.jisf.driver.controller;

import com.jisf.driver.entity.vo.AllotRolesVo;
import com.jisf.driver.response.IErrorCode;
import com.jisf.driver.response.Result;
import com.jisf.driver.service.IUserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author jisf
 * @since 2022-04-08
 */
@RestController
@RequestMapping("/driver/userRole")
public class UserRoleController {

    @Autowired
    private IUserRoleService iUserRoleService;

    @PostMapping("allotRoles")
    @PreAuthorize("hasAnyAuthority('userRole:allotRoles')")
    public Result<?> allotRoles(@RequestBody AllotRolesVo allotRolesVo){
        IErrorCode iErrorCode = iUserRoleService.allotRoles(allotRolesVo);
        return Result.ok(iErrorCode);
    }

}
